//index.js
//获取应用实例
const app = getApp()
import util from '../../utils/util.js';
Page({
  data: {},
  onShow: function () {
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
        selected: 2
      })
    }
  },
  setTabBarActive () {
    let tabBarData = this.getTabBar().data.list
    let barIndex = util.getTabBarIndex(tabBarData)
    console.log('tabindex' + barIndex)
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
        selected: barIndex
      })
    }
  }
})